cmake_minimum_required(VERSION 3.0)
project(pushserver)

include_directories(thrid-party .)

include(add_subdir.cmake)

set(config_files
        ${PROJECT_SOURCE_DIR}/server.json
        ${PROJECT_SOURCE_DIR}/sqlserver.json)

file(COPY ${config_files} DESTINATION ${PROJECT_BINARY_DIR})

add_executable(PushServer main.cpp)

include(lib.cmake)

set_target_properties(PushServer PROPERTIES INSTALL_RPATH "./lib64")

set(CMAKE_INSTALL_PREFIX /home/xuke/Desktop/svr)

install(
        TARGETS PushServer ${libs}
        CONFIGURATIONS Release
        BIN DESTINATION ${CMAKE_INSTALL_PREFIX}
        LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib64
        COMPONENT Libraries
        NAMELINK_COMPONENT Development
)

install(
        FILES ${config_files}
        DESTINATION ${CMAKE_INSTALL_PREFIX}
)
set(connector_lib
        ${PROJECT_SOURCE_DIR}/thrid-party/connector/lib64/libmysqlcppconn.so
        ${PROJECT_SOURCE_DIR}/thrid-party/connector/lib64/libmysqlcppconn.so.9)

install(
        FILES ${connector_lib}
        DESTINATION ${CMAKE_INSTALL_PREFIX}/lib64
)
